from selenium import webdriver
from time import sleep
from selenium.webdriver.common.by import By
from selenium.webdriver.support.select import Select
from selenium.webdriver.common.keys import Keys

auto=webdriver.Chrome()
auto.maximize_window()
auto.get("http://116.62.125.96/zentao/user-login.html?tid=xuc7908o")
sleep(3)

# a=auto.find_element(By.ID,"account").send_keys("liruyue")
a=auto.find_element(By.CSS_SELECTOR,"#account").send_keys("liruyue")

sleep(3)
b=auto.find_element(By.XPATH,"//*[@id='loginPanel']/div/div[2]/form/table/tbody/tr[2]/td/input")
b.send_keys("Test1234")
sleep(3)
auto.find_element(By.CSS_SELECTOR,".checkbox-primary > input").click()
sleep(3)
c=auto.find_element(By.ID,"submit")
c.click()
sleep(6)
#点击产品按钮
auto.find_element(By.XPATH,"//span[text()='产品']").click()
sleep(3)
#添加产品
auto.switch_to.frame("appIframe-product")
sleep(3)
auto.find_element(By.XPATH,"//a[text()='添加产品']").click()
sleep(3)
#选择项目集
b1=auto.find_element(By.XPATH,"//*[@id='program_chosen']/a")
b1.send_keys(Keys.DOWN,Keys.ENTER)
sleep(3)


#选择产品类型（select下拉框）
t1=auto.find_element(By.ID,"type")
Select(t1).select_by_index(2)
sleep(2)
auto.quit()